<template>
  <view class="ejectP">
    <u-navbar :is-back="true" title="确认提现" back-text="">
      <view
        class="slot-right"
        style="width: 100%; display: flex; justify-content: flex-end"
      >
        <!-- <view>
                <image @click="goSettingM" style="width: 1rem;padding: 1rem;" src="../../style/image/my/设 置.png" alt="">
                </view> -->
      </view>
    </u-navbar>

    <view class="info">
      <view style="text-align: center; margin: 1rem">
        <u-avatar
          style="text-align: center"
          :src="src"
          mode="square"
        ></u-avatar>
      </view>
      <view
        style="
          font-size: 0.83rem;
          text-align: center;
          margin: 1rem;
          font-family: PingFang SC;
          font-weight: 400;
          color: #000000;
        "
        >{{ nickName }}</view
      >
      <view
        style="
          font-size: 0.83rem;
          text-align: center;
          margin: 1rem;
          font-family: PingFang SC;
          font-weight: 300;
          color: #000000;
        "
        >已向{{phone}}发送短信验证码
      </view>
    </view>

    <view class="inputP">
      <view
        style="
          font-size: 0.78rem;
          font-family: PingFang SC;
          text-align: center;
          margin: 1rem;
          color: #666666;
        "
        >请输入验证码</view
      >
      <u-message-input mode="box"  @finish="finish" :maxlength="6"></u-message-input>
    </view>

    <view class="footP"  @click="addPosM">
      <view
       
        style="padding: 0.7rem; display: flex; align-items: center"
      >
        <!-- <image style="width: 1rem;" src="../../style/image/cargo/add.jpg" alt=""> -->
        <view style="color: white; margin-left: 0.2rem">确认</view>
      </view>
    </view>
     <u-toast ref="uToast" />

  </view>
</template>

<script lang='ts' >
import { Component, Prop, Vue, Watch, Emit } from "vue-property-decorator";

import { bindingZfb, sendMsgCDB, drawMoney } from "../../utils/uniApi";
import { AppModule } from "../../store/modules/app";

@Component({
  //   @Component  是一个装修器   不可以在下面写语句
  name: "test",
})
export default class extends Vue {
  @Prop({
    type: String, // 父组件传递给子组件的数据类型
    required: false, // 是否必填
    default: " ", // 默认值， 如果传入的是 Object，则要 default: ()=>({}) 参数为函数
  })
  msg!: string;
  public radioValue = "1";

  public src = "";
  public nickName = "";
  public phone=''

  public info = {
    userId:
      uni.getStorageSync("userId") == ""
        ? ""
        : parseInt(uni.getStorageSync("userId")), //	shopId 或 userId
    type:uni.getStorageSync("otherData").porxyShop=='porxy'?'0':'1', //申请人关联ID类型（0 代理 ,1 商户,）
    money: "", //提现金额
    verifyCode: "", //短信验证码
  };

  created() {}

  mounted() {
    //  console.log('父组件传递的参数:',this.$parent)   //暂时不考虑
    //  uni.navigateTo({
    // url: './selectBusin'
    // });
    this.phone= uni.getStorageSync("otherData").phone
    this.src = uni.getStorageSync("otherData").headImg;
    this.nickName = uni.getStorageSync("otherData").nickName;
  }
  onLoad(options: any) {
    console.log(JSON.parse(options.data));
    this.info = JSON.parse(options.data);

    var params = {
      recCode: "", // 推荐码(注册时必传，其他非必传)
      phone: uni.getStorageSync("otherData").phone, // 手机号
      type: "drawMoney", //发送验证码场景 （register：注册 pwd：修改密码  drawMoney：提现   bindingZfb：绑定支付宝  bindingIdentity：绑定身份证）
    };

    sendMsgCDB(params).then((res: any) => {
      // console.log(6)

      (this.$refs.uToast as any).show({
        title: res.data.message,
        type: "primary",
      });
    });
  }

  goejectNextM() {
    console.log("123");
  }

  finish(e:any){

    this.info.verifyCode=e
  
  }

  addPosM() {
    console.log("确认提现");

    drawMoney(this.info).then((res: any) => {
     
      uni.showToast({
        title: res.data.message,
        icon: "none",
        duration: 2000,
      });
          if(res.data.message=='提现成功'){
          
              uni.navigateTo({
        url: `./sureWithdraw`,
      });
          }


    });


  }
}
</script>

<style  lang="scss"  scoped>
>>> .u-input__input {
  min-height: 38px;
  font-size: 2rem;
}

.heads {
  margin: 1rem;
  padding: 1rem;

  box-shadow: 1px 1px 10px 3px rgba(144, 144, 144, 0.1);

  /* box-shadow: 0rem 0rem 1px 1px rgba(0, 0, 0, 0.1); */
  border-radius: 0.3rem;
}

.tips {
  font-size: 0.66rem;
  font-family: PingFang SC;
  font-weight: 300;
  color: #656565;
  margin: 1rem;
}
.appily {
  margin: 1rem;
}
.myProlifIcon-title {
  display: flex;
  align-items: center;
  margin: 1rem 0rem;
}
.myProlifIcon-text {
  /* // width: 20.84rem;
    // height: 49.09rem; */
  margin-left: 0.3rem;
}
.myProlifIcon-func-content {
  display: flex;
}

.myProlifIcon {
  width: 0.17rem;
  height: 0.84rem;
  background: #02b074;
  border-radius: 1rem;
}
.myProlifIcon-content {
  height: 7.7rem;
  background: #ffffff;
  box-shadow: 1rem 0.5rem 1rem 0.5rem rgba(154, 154, 154, 0.18);
  border-radius: 0.5rem;
  padding: 1rem;
}

.way {
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
}

.footP {
  position: absolute;
  bottom: 0;
  background-color: #02af74;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.inputP {
  background: #ffffff;
  box-shadow: 0rem 0rem 1rem 0rem rgba(0, 0, 0, 0.1);
  border-radius: 0.3rem;
  margin: 1rem;
  padding: 1rem;
}
</style>